
//const baseUrl = "http://120.26.174.70:9090";
// const baseUrl= "https://exam.free.qydev.com";  
 const baseUrl= "https://exam.vip.qydev.com"; 
// const baseUrl= "https://lantian.free.qydev.com";   
//  const baseUrl= "https://exam2.free.qydev.com"; 

//查询全国比赛
export const allNationCompetition = params => (
	uni.request({
		url: `${baseUrl}/enableExam/competition/all?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)

//颁发全国大赛证书
export const banfadasai = params => (
	uni.request({
		url: `${baseUrl}/enableExam/competition/admin?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method:'POST'
	})
)
//师生注册表
export const zhuce = params => (
	uni.request({
		url: `${baseUrl}/users/export/url?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)

//我的等级考试次数
export const mysignNumber = params => (
	uni.request({
		url: `${baseUrl}/exam/mysign?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
		
	})
)
//查询有多少次付费报名
export const paySignNum = params => (
	uni.request({
		url: `${baseUrl}/questionBank/record?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)
//查询总共有多少次报名
export const signNum = params => (
	uni.request({
		url: `${baseUrl}/questionBank/record/all?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)
//判断是否参加过等级考试
export const isAnswer = params => (
	uni.request({
		url: `${baseUrl}/questionBank/isAnswer?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)

//修改管理员备注
export const updataNotice = params => (
	uni.request({
		url: `${baseUrl}/notices/update?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
 			'content-type':'application/json'
		},
		method:'POST'
	})
)

//通过手机号给用户分配权限
export const giveAdmin = params => (
	uni.request({
		url: `${baseUrl}/users/giveAdmin?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
 			'content-type':'application/x-www-form-urlencoded'
		},
		method:'POST'
	})
)

//查询用户角色
export const usersRole = params => (
	uni.request({
		url: `${baseUrl}/users/role?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)
//查询所有图片
export const getAllPicture = params => (
	uni.request({
		url: `${baseUrl}/lunbo/all?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)
//更换图片
export const replaceImage = params => (
	uni.request({
		url: `${baseUrl}/lunbo?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
 			'content-type':'application/x-www-form-urlencoded'
		},
		method:'POST'
	})
)

 //上传图片接口
 export const updataImage = params => (
 	uni.request({
 		url: `${baseUrl}/uploads/images`,
 		data: params,
 		header: {
 			'exam-token': uni.getStorageSync('exam-token'),
 			'content-type':'application/x-www-form-urlencoded'
 		},
 		method: 'POST'
 	})
 )

//查询全国大赛
export const competitions = params => (
	uni.request({
		url: `${baseUrl}/competitions?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)
//增加全国大赛
export const plusMatchList = params => (
	uni.request({
		url: `${baseUrl}/competitions`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type': 'application/json'
		},
		method: 'POST'
	})
)
//删除全国大赛
export const delectMatchList = params => (
	uni.request({
		url: `${baseUrl}/competitions/delete`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'GET'
	})
)
//生成证书
export const getCertificalList = params => (
	uni.request({
		url: `${baseUrl}/enableExam/competition`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'POST'
	})
)
//查询登录用户信息
export const getuserInfo = params => (
	uni.request({
		url: `${baseUrl}/users?time=`+ new Date().toString(),
		data: params,
		header: {
			"exam-token":  uni.getStorageSync('exam-token')
		},
		method: 'GET'
	})
)
//编辑个人信息
export const bjuserInfo = params => (
	uni.request({
		url: `${baseUrl}/users`,
		data: params,
		header: {
			"exam-token":  uni.getStorageSync('exam-token'),
			'content-type': 'application/json'
		},
		method: 'POST'
	})
)

export const getBankQuestion = params => (
	uni.request({
		url: `${baseUrl2}/questionBank/exam?time=`+ new Date().toString(),
		data: params,
		header: {
			"exam-token":  uni.getStorageSync('exam-token')
		}
	})
)
//查询大赛报名
export const competitionSignup = params => (
	uni.request({
		url: `${baseUrl}/competitionSignup?time=`+ new Date().toString(),
		data: params,
		header: {
			"exam-token":  uni.getStorageSync('exam-token'),
			'content-type': 'application/json'
		},
		method: 'POST'
	})
)
//导出报名表
export const downloadSign = params => (
	uni.request({
		url: `${baseUrl}/competitionSignup/export/url`,
		data: params,
		header: {
			"exam-token":  uni.getStorageSync('exam-token'),
		},
		method: 'GET'
	})
)
//查询项目
export const projects = params => (
	uni.request({
		url: `${baseUrl}/projects?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		}
	})
)
//删除项目
export const deleteProjectsList = params => (
	uni.request({
		url: `${baseUrl}/projects/delete`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), 
			'content-type':'application/x-www-form-urlencoded'
		},
		method:'GET'
	})
)
//增加项目
export const pProjects = params => (
	uni.request({
		url: `${baseUrl}/projects`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/json'
		},
		method:'POST'
		
	})
)
//查询排行榜
export const grade = params => (
	uni.request({
		url: `${baseUrl}/grade?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		},
		method: 'GET'
	})
)
//导出排行榜
export const gradeUrl = params => (
	uni.request({
		url: `${baseUrl}/grade/export/url`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'GET'
	})
)
//给胜负项目排序
export const flagOrder = params => (
	uni.request({
		url: `${baseUrl}/grade/flag/order`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/json'
		},
		method:'POST'
		
	})
)


//颁发证书
export const banfaCerfict = params => (
	uni.request({
		url: `${baseUrl}/enableExam/giveLeve`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/json'
		},
		method:'POST'
		
	})
)

export const users = params => (
	uni.request({
		url: `${baseUrl}/users?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		},
		method: 'GET'
	})
)
export const nationCompetition = params => (
	uni.request({
		url: `${baseUrl}/person/nationCompetition?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		},
		method: 'GET'
	})
)
//个人中心，我的等级证书
export const leave = params => (
	uni.request({
		url: `${baseUrl}/person/leave?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		},
		method: 'GET'
	})
)
//我的购买记录
export const pay = params => (
	uni.request({
		url: `${baseUrl}/person/pay?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		},
		method: 'GET'
	})
)
export const mySign = params => (
	uni.request({
		url: `${baseUrl}/person/sign?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		},
		method: 'GET'
	})
)
//等级考试
export const exam = params => (
	uni.request({
		url: `${baseUrl}/exam?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token') //自定义请求头信
		},
		method: 'GET'
	})
)	
//删除等级考试
export const deleteExamj = params => (
	uni.request({
		url: `${baseUrl}/exam/delete`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'),
		},
		method: 'GET'
	})
)	
//增加等级考试
export const plusExam = params => (
	uni.request({
		url: `${baseUrl}/exam`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/json'
		},
		method: 'POST'
	})
)	
//关闭等级考试
export const closeExamList = params => (
	uni.request({
		url: `${baseUrl}/enableExam/closeLeve`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'POST'
	})
)	
//下载报名结果
export const signResult = params => (
	uni.request({
		url: `${baseUrl}/exam/result/export/url`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'GET'
	})
)	
//下载等级考试报名表
export const signTable = params => (
	uni.request({
		url: `${baseUrl}/exam/sign/export/url`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'), //自定义请求头信
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'GET'
	})
)

export const login = params => (
	uni.request({
		url: `${baseUrl}/login/wxLogin`,
		data: params,
		method: 'POST'
	})

)

export const lunbo = params => (
	uni.request({
		url: `${baseUrl}/lunbo?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)
//查询通知管理员备注
export const notice = params => (
	uni.request({
		url: `${baseUrl}/notices?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		}
	})
)
//管理员备注
// export const noticeAdmin = params => (
// 	uni.request({
// 		url: `${baseUrl}/notices`,
// 		data: params,
// 		header: {
// 			'exam-token': uni.getStorageSync('exam-token')
// 		}
// 	})
// )
//增加大赛通知
export const plus_notice = params => (
	uni.request({
		url: `${baseUrl}/notices`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/json'
		},
		method:'POST'
	})
)
//删除大赛通知
export const deleteNoticeList = params => (
	uni.request({
		url: `${baseUrl}/notices/delete`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/json'
		},
		method:'GET'
	})
)
//查询题库
export const questionBank = params => (
	uni.request({
		url: `${baseUrl}/questionBank?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		},
		method:'GET'
	})
)
//增加题目
export const pQuestionList = params => (
	uni.request({
		url: `${baseUrl}/questionBank`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/json'
		},
		method: 'POST'
	})
)
//删除题库的题目
export const deleteQuestion = params => (
	uni.request({
		url: `${baseUrl}/questionBank/delete`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method:'GET'
	})
)
//查询考试配置
export const queryConfig = params => (
	uni.request({
		url: `${baseUrl}/questionBank/config?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token')
		},
		method:'GET'
	})
)
//配置某场等级考试题目数量
export const configNum = params => (
	uni.request({
		url: `${baseUrl}/questionBank/config`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method:'POST'
	})
)
//配置整个题库考试题目分数
export const cAllScore = params => (
	uni.request({
		url: `${baseUrl}/questionBank/config/score/bank`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'POST'
	})
)
//配置单个考试题目的分数
export const singleScore = params => (
	uni.request({
		url: `${baseUrl}/questionBank/config/score/single`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'POST'
	})
)
//删除考试题目
export const clearQuestion = params => (
	uni.request({
		url: `${baseUrl}/questionBank/delete/config`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method:'GET'
	})
)

export const start = params => (
	uni.request({
		url: `${baseUrl}/questionBank/start`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'POST'
	})
)
export const next = params => (
	uni.request({
		url: `${baseUrl}/questionBank/next`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/json'
		},
		method: 'POST'
	})
)
export const last = params => (
	uni.request({
		url: `${baseUrl}/questionBank/last`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'POST'
	})
)
export const result = params => (
	uni.request({
		url: `${baseUrl}/questionBank/result`,
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method: 'POST'
	})
)
//答题回顾
export const answerReview = params => (
	uni.request({
		url: `${baseUrl}/questionBank/review?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token': uni.getStorageSync('exam-token'),
			'content-type':'application/x-www-form-urlencoded'
		},
		method:'GET'
	})
)

//录入成绩
export const wRecord = params => (
	uni.request({
		url: `${baseUrl}/grade`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token'),
			'content-type':'application/json'
		},
		method: 'POST'
	})
)
//查询参加大赛用户信息
export const numquery = params => (
	uni.request({
		url: `${baseUrl}/grade/sign`,
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token')
		}
	})
)

//查询参加大赛用户信息
export const wxpay = params => (
	uni.request({
		url: `${baseUrl}/api/v1/weixin/payment?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token')
		},
		method: 'POST'
	})
)
//查询用户是否支付等级考试费用
export const paystatus = params => (
	uni.request({
		url: `${baseUrl}/api/v1/state?time=`+ new Date().toString(),
		data: params,
		header: {
			'exam-token':  uni.getStorageSync('exam-token')
		}
	})
)

